package me.xplabs.model 
{
	import flash.utils.ByteArray;
	import me.xplabs.model.proxy.EnergyWaveProxy;
	import me.xplabs.model.proxy.MMapManagerProxy;
	import me.xplabs.msg.NotificationName;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author xiaohan
	 */
	public class LoaderMapCommand extends SimpleCommand 
	{
		
		public function LoaderMapCommand() 
		{
			
		}
		override public function execute(notification:INotification):void 
		{
			switch(notification.getType())
			{
				case NotificationName.LOADER_MAP_COMPLETE:
					if (!facade.hasProxy(MMapManagerProxy.NAME)) facade.registerProxy(new MMapManagerProxy());
					MMapManagerProxy(facade.retrieveProxy(MMapManagerProxy.NAME)).updateMapData(ByteArray(notification.getBody().data), notification.getBody().raidId);
					break;
				case NotificationName.LOADER_ENERGY_COMPLETE:
					if (!facade.hasProxy(EnergyWaveProxy.NAME)) facade.registerProxy(new EnergyWaveProxy());
					EnergyWaveProxy(facade.retrieveProxy(EnergyWaveProxy.NAME)).updateEnergyData(XML(notification.getBody()));
					break;
			}
		}
	}

}